package com.dingwen.treasure.business.service.impl;

import com.dingwen.treasure.business.component.task.DayTaskGenerate;
import com.dingwen.treasure.business.component.task.MonthTaskGenerate;
import com.dingwen.treasure.business.model.dto.TaskGenerateDto;
import com.dingwen.treasure.business.model.entity.TaskGenerate;
import com.dingwen.treasure.business.service.TaskGenerateService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * 　TaskGenerateServiceImpl
 * 　@author dingwen
 * 　@date 2022/8/4
 */
@Service
@Slf4j
public class TaskGenerateServiceImpl implements TaskGenerateService {

    @Resource
    private DayTaskGenerate dayTaskGenerate;

    @Resource
    private MonthTaskGenerate monthTaskGenerate;

    /**
     * 生成
     *
     * @param taskGenerateDto 任务生成dto
     */
    @Override
    public void generate(TaskGenerateDto taskGenerateDto) {
        dayTaskGenerate.setNextTaskGenerate(monthTaskGenerate);
        dayTaskGenerate.execute(taskGenerateDto);
    }

    /**
     * 批量存库
     *
     * @param taskGenerates 任务
     */
    @Override
    public void saveBath(List<TaskGenerate> taskGenerates) {
        log.info("任务批量存库...");
    }
}
